package com.ruoyi.generator.controller.ysd;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysMenu;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.generator.domain.GenForm;
import com.ruoyi.generator.domain.GenTable;
import com.ruoyi.generator.domain.GenTableConfig;
import com.ruoyi.generator.service.IFromCrudBtnsService;
import com.ruoyi.generator.service.IFromCrudTableConfigService;
import com.ruoyi.generator.service.IGenTableService;
import com.ruoyi.generator.service.impl.FromBuildConfigServiceImpl;
import com.ruoyi.system.service.ISysMenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * CRUD 按钮
 */
@RestController
public class YsdCrudButtonController extends BaseController
{
    @Autowired
    private IFromCrudBtnsService fromCrudBtnsService;

    /**
     * 根据表单设计KEY获取对应按钮配置信息
     * @returnT
     */
    @GetMapping("/form/crud/btns/{buildKey}")
    public AjaxResult getCrudBtnsByBuildKey(@PathVariable("buildKey") String buildKey) throws Exception {
        if(StringUtils.isEmptyIncludeNull(buildKey)){
            return AjaxResult.success();
        }
        return AjaxResult.success(fromCrudBtnsService.selectFromCrudBtnsByBuildKey(buildKey));
    }

}
